package Logic.EventSample.Goods.Use;

import FrameWork.Model.Player;
import org.springframework.stereotype.Component;

/**
 * 耐久度改变处理器
 */
@Component
public class DurabilityChangeHandler implements UseGoodHandler {

    @Override
    public void onUseGood(Player player, int goodsId, int cnt) {
        if (isDurabilityChangeable(goodsId)){
            changeDurability(player,goodsId,cnt,-1);
        }
    }

    //是否具有耐久度
    private boolean isDurabilityChangeable(int goodsId){
        return true;
    }

    //改变耐久度
    private void changeDurability(Player player,int goodsId,int cnt,int delta){
        //具体逻辑
        System.out.println("道具"+goodsId+"耐久度减少"+delta);
    }

}
